/*
 * Copyright (c) Extreme Vision Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef COMMON_H
#define COMMON_H

#include <opencv2/core.hpp>

namespace ev
{
namespace vision
{


/**
* @brief detection bbox info
* @param x1: min x coordinate without normalization
* @param x2: max x coordinate without nornalization
* @param y1: min y coordinate without nornalization
* @param y2: max y coordinate without nornalization
* @param score: confidence
* @param label: label info
*/
typedef struct BoxInfo
{
    float x1;
    float y1;
    float x2;
    float y2;
    float score;
    int label;
} BoxInfo;

/**
* @brief bbox IOU function
* @param[in] b1: bbox with cv::Rect format
* @param[in] b2: bbox with cv::Rect format
* @return float: iou
*/
float IOU(const cv::Rect &b1, const cv::Rect &b2);
/**
* @brief bbox nms function
* @param[in] objects: array of BoxInfo
* @param[in] iou_thresh: thresh of iou
* @param[in] class_aware: true for label class aware
* @return objects after nms
*/
void NMS(std::vector<BoxInfo> &objects, float iou_thresh, bool class_aware);



}//namespace vision
}//namespace ev
#endif